<?php
/**
 * @package		Joomla.Administrator
 * @subpackage	com_jobs
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
?>
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
		
		if (task == 'job.cancel' || document.formvalidator.isValid(document.id('job-form'))) {
			<?php echo $this->form->getField('description')->save(); ?>
			Joomla.submitform(task, document.getElementById('job-form'));
		}
		else {
			alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
		}
	}
	
	function showhideoffer()
	  {
		  var ind = $$('#offer').get("value") ;
		  if(ind==14) { hideoffer();$$('.show1').show(); }
		  if(ind==15) { hideoffer();$$('.show2').show(); }
		  if(ind==16) { hideoffer();$$('.show3').show(); }
	  }
	  function hideoffer() {
		  $$('.show1').hide() ;
		  $$('.show2').hide() ;
		  $$('.show3').hide() ; 
  		} 	
	 
</script>

<form action="<?php echo JRoute::_('index.php?option=com_jobs&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="job-form" enctype="multipart/form-data"  class="form-validate">
	<div class="width-60 fltlft">
		<fieldset class="adminform">
			<legend><?php echo empty($this->item->id) ? JText::_('COM_JOBS_NEW_JOB') : JText::sprintf('COM_JOBS_EDIT_JOB', $this->item->id); ?></legend>
			<ul class="adminformlist">
				<li><?php echo $this->form->getLabel('title'); ?>
				<?php echo $this->form->getInput('title'); ?></li>
                
				<li><?php echo $this->form->getLabel('userid'); ?>
				<?php echo $this->form->getInput('userid'); ?></li>
                
				<li><?php echo $this->form->getLabel('alias'); ?>
				<?php echo $this->form->getInput('alias'); ?></li>

				
				<li><?php echo $this->form->getLabel('guests'); ?>
				<?php echo $this->form->getInput('guests'); ?></li>
                
                <li><?php echo $this->form->getLabel('deadline'); ?>
				<?php echo $this->form->getInput('deadline'); ?></li>
                 <li><?php echo $this->form->getLabel('start_hour'); ?>
				<?php echo $this->form->getInput('start_hour'); ?></li>
                 <li><?php echo $this->form->getLabel('start_minute'); ?>
				<?php echo $this->form->getInput('start_minute'); ?></li>
				
                 <li><?php echo $this->form->getLabel('address'); ?>
				<?php echo $this->form->getInput('address'); ?></li>
				
                <li><?php echo $this->form->getLabel('postcode'); ?>
				<?php echo $this->form->getInput('postcode'); ?></li>
                
                <li><?php echo $this->form->getLabel('city'); ?>
				<?php echo $this->form->getInput('city'); ?></li>
                
                <li><?php echo $this->form->getLabel('offer'); ?>
				<?php echo $this->form->getInput('offer'); ?></li>
                
                <li class="show1"><?php echo $this->form->getLabel('sub_food'); ?>
				<?php echo $this->form->getInput('sub_food'); ?></li>
                <li class="show1"><?php echo $this->form->getLabel('sub_food_other'); ?>
				<?php echo $this->form->getInput('sub_food_other'); ?></li>
                <li class="show1"><?php echo $this->form->getLabel('sub_drink'); ?>
				<?php echo $this->form->getInput('sub_drink'); ?></li>
                <li class="show1"><?php echo $this->form->getLabel('sub_drink_other'); ?>
				<?php echo $this->form->getInput('sub_drink_other'); ?></li>
                
                
                <li class="show2"><?php echo $this->form->getLabel('sub_room_time'); ?>
				<?php echo $this->form->getInput('sub_room_time'); ?></li>
                 <li class="show2"><?php echo $this->form->getLabel('sub_room_country'); ?>
				<?php echo $this->form->getInput('sub_room_country'); ?></li>
                
                <li  class="show3"><?php echo $this->form->getLabel('sub_rent'); ?>
				<?php echo $this->form->getInput('sub_rent'); ?></li>
                 <li  class="show3"><?php echo $this->form->getLabel('sub_rent_desc'); ?>
				<?php echo $this->form->getInput('sub_rent_desc'); ?></li>

                <li style="display:none;"><?php echo $this->form->getLabel('catid'); ?>
				<?php echo $this->form->getInput('catid'); ?></li>
                

				<li><?php echo $this->form->getLabel('state'); ?>
				<?php echo $this->form->getInput('state'); ?></li>

				<li><?php echo $this->form->getLabel('access'); ?>
				<?php echo $this->form->getInput('access'); ?></li>

				<li><?php echo $this->form->getLabel('ordering'); ?>
				<?php echo $this->form->getInput('ordering'); ?></li>

				<li><?php echo $this->form->getLabel('language'); ?>
				<?php echo $this->form->getInput('language'); ?></li>

				<li><?php echo $this->form->getLabel('id'); ?>
				<?php echo $this->form->getInput('id'); ?></li>
			</ul>

			<div>
				<?php echo $this->form->getLabel('description'); ?>
				<div class="clr"></div>
				<?php echo $this->form->getInput('description'); ?>
			</div>
		</fieldset>
	</div>

	<div class="width-40 fltrt">
		<?php echo JHtml::_('sliders.start', 'job-sliders-'.$this->item->id, array('useCookie'=>1)); ?>

		<?php echo JHtml::_('sliders.panel', JText::_('JGLOBAL_FIELDSET_PUBLISHING'), 'publishing-details'); ?>

		<fieldset class="panelform">
			<ul class="adminformlist">
				<li><?php echo $this->form->getLabel('created_by'); ?>
				<?php echo $this->form->getInput('created_by'); ?></li>

				<li><?php echo $this->form->getLabel('created_by_alias'); ?>
				<?php echo $this->form->getInput('created_by_alias'); ?></li>

				<li><?php echo $this->form->getLabel('created'); ?>
				<?php echo $this->form->getInput('created'); ?></li>

				<li><?php echo $this->form->getLabel('publish_up'); ?>
				<?php echo $this->form->getInput('publish_up'); ?></li>

				<li><?php echo $this->form->getLabel('publish_down'); ?>
				<?php echo $this->form->getInput('publish_down'); ?></li>

				<?php if ($this->item->modified_by) : ?>
					<li><?php echo $this->form->getLabel('modified_by'); ?>
					<?php echo $this->form->getInput('modified_by'); ?></li>

					<li><?php echo $this->form->getLabel('modified'); ?>
					<?php echo $this->form->getInput('modified'); ?></li>
				<?php endif; ?>

				<?php if ($this->item->hits) : ?>
					<li><?php echo $this->form->getLabel('hits'); ?>
					<?php echo $this->form->getInput('hits'); ?></li>
				<?php endif; ?>

			</ul>
		</fieldset>

		<?php echo $this->loadTemplate('params'); ?>

		<?php echo $this->loadTemplate('metadata'); ?>

		<?php echo JHtml::_('sliders.end'); ?>

		<input type="hidden" name="task" value="" />
		<?php echo JHtml::_('form.token'); ?>
        <br/>
        <fieldset class="panelform">
        <b>Info of caterer order</b>
        <ul class="adminformlist">
        <?php
		$model = $this->getModel('job');		
		$user		= JFactory::getUser();			 	
		
		$listcompany =  $model->getInfoEvents($this->item->id);
		//print_r($listcompany );
		for($i=0;$i<sizeof($listcompany);$i++)
		{
			//$userinfo = $model->getUserInfo($listcompany[$i]->userid);
			
			$catererinfo = $model->getCatererInfo($listcompany[$i]->catererid);
			if(isset($catererinfo)) {
				echo "<li style='padding-top:10px;'>";
				echo "Email :" . $catererinfo->email 
				. '<br/>Phone : ' . $catererinfo->phone 
				. '<br/>Address : ' . $catererinfo->address .' , '. $catererinfo->postcode . ' , '.$catererinfo->city 
				;
				//echo "<br>Status : " . $workinfo->title . "";
				echo "</li>";
			}
		}
        ?>
		</ul>
        
        </fieldset>
	</div>
	<div class="clr"></div>
</form>
<script type="text/javascript">
showhideoffer();
</script>